//package io.github.chingow.istock.spider.thread;
//
//import lombok.extern.slf4j.Slf4j;
//
//import java.util.concurrent.BlockingQueue;
//import java.util.concurrent.RejectedExecutionHandler;
//import java.util.concurrent.ThreadFactory;
//import java.util.concurrent.ThreadPoolExecutor;
//import java.util.concurrent.TimeUnit;
//
///**
// *  线程池监控
// * @author chingow
// * @create 2019-10-24 22:26
// **/
//@Slf4j
//public class MonitorThreadPoolExecutor extends ThreadPoolExecutor {
//
//    public MonitorThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
//        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
//    }
//
//    public MonitorThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
//        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
//    }
//
//    public MonitorThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
//        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
//    }
//
//    public MonitorThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
//        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
//    }
//
//    @Override
//    protected void beforeExecute(Thread t, Runnable r) {
//        super.beforeExecute(t, r);
////        log.info("beforeExecute...");
//    }
//
//    @Override
//    protected void afterExecute(Runnable r, Throwable t) {
//        super.afterExecute(r, t);
//        log.info("{}",String.format("总线程数:%s,活动线程数:%s,执行完成线程数:%s,排队线程数:%s",
//                getTaskCount(),
//                getActiveCount(),
//                getCompletedTaskCount(),
//                getQueue().size()
//        ));
//    }
//
//    @Override
//    protected void terminated() {
//        super.terminated();
//        log.error("terminated...");
//    }
//}
